home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / src / WBBump_src.lha / WBBump_src / wbbump.e < prev    next >
Encoding:
Text File  |  1999-06-30  |  2.2 KB  |  121 lines

  1. /* ******** */
  2. /* wbbump.e */
  3. /* ******** */
  4.  
  5. /*
  6.     WBBump - Bumpmapping on the Workbench!
  7.  
  8.     Copyright (C) 1999  Thomas Jensen - dm98411@edb.tietgen.dk
  9.  
  10.     This program is free software; you can redistribute it and/or modify
  11.     it under the terms of the GNU General Public License as published by
  12.     the Free Software Foundation; either version 2 of the License, or
  13.     (at your option) any later version.
  14.  
  15.     This program is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.     GNU General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU General Public License
  21.     along with this program; if not, write to the Free Software Foundation,
  22.     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. */
  24.  
  25.  
  26.  
  27. MODULE    'dos/dos'    -> SIGBREAKF_CTRL_C
  28.  
  29.  
  30. MODULE    '*bumper',
  31.         '*get_bumper',
  32.         '*prefs',
  33.         '*errors',
  34.         '*version',
  35.         '*commodity',
  36.         '*pluginmanager',
  37.         '*libs'
  38.  
  39.  
  40. PROC main() HANDLE
  41.     DEF    p=NIL:PTR TO prefs,
  42.         b=NIL:PTR TO bumper,
  43.         cx=NIL:PTR TO cx,
  44.         oldpri="nset",
  45.         enabled=TRUE,
  46.         done=FALSE,
  47.         reload=FALSE,
  48.         plist=NIL:PTR TO pluginlist,
  49.         cmd
  50.  
  51.     open_libs()
  52.  
  53.     REPEAT
  54.  
  55.         NEW plist.pluginlist()
  56.         plist.loadall()
  57.  
  58.         NEW p.read_prefs()
  59.  
  60.         NEW cx.cx(p)
  61.  
  62.         Delay(p.startdelay * 50)
  63.  
  64.         oldpri := SetTaskPri(FindTask(NIL), p.taskpri)
  65.  
  66.         b := get_bumper(p, plist)
  67.  
  68.         reload := FALSE
  69.  
  70.         REPEAT
  71.             WHILE cmd := cx.nextmsg()
  72.                 SELECT cmd
  73.                     CASE MSG_QUIT
  74.                         done := TRUE
  75.                     CASE MSG_ENABLE
  76.                         enabled := TRUE
  77.                     CASE MSG_DISABLE
  78.                         enabled := FALSE
  79.                     CASE MSG_APPEAR
  80.                         p.edit()
  81.                 ENDSELECT
  82.             ENDWHILE
  83.  
  84.             IF enabled
  85.  
  86.                 b.update()
  87.  
  88.             ELSE
  89.  
  90.                 Wait(SIGBREAKF_CTRL_C OR cx.sigflag)
  91.  
  92.             ENDIF
  93.  
  94.             IF p.haschanged() THEN reload := TRUE
  95.  
  96.         UNTIL (SetSignal(0,0) AND SIGBREAKF_CTRL_C) OR done OR reload
  97.  
  98.         END cx;    cx := NIL
  99.         END b;    b := NIL
  100.         END p;    p := NIL
  101.         END plist; plist := NIL
  102.  
  103.     UNTIL (SetSignal(0,0) AND SIGBREAKF_CTRL_C) OR done
  104.  
  105. EXCEPT DO
  106.     IF oldpri <> "nset" THEN SetTaskPri(FindTask(NIL), oldpri)
  107.  
  108.     END cx
  109.     END b
  110.     END p
  111.  
  112.     END plist
  113.  
  114.     close_libs()
  115.  
  116.     IF exception THEN show_error(exception, exceptioninfo)
  117. ENDPROC
  118.  
  119.  
  120.  
  121.